<template>
<view>
	<u-navbar :is-back="false" title="商品详情"
	  title-size="30"
	  :background="{background:'#2B88FE' }"
	  title-color="#fff">
	  <div class="head_icon">
	    <u-icon @click="$api.handleBackTo"
	      name="arrow-left" color="#fff"
	      size="36">
	    </u-icon>
	    <u-icon @click="$api.handleHomeTo"
	      name="home" color="#fff" size="36">
	    </u-icon>
	  </div>
	</u-navbar>

  <div>
    <appProduct :li="detail">
    </appProduct>
    <u-table>
      <u-tr>
        <u-th>时间</u-th>
        <u-th>类型</u-th>
        <u-th>出货数</u-th>
        <u-th>剩余库存</u-th>
      </u-tr>
      <u-empty text="暂无数据"
        mode="list"
        v-if="!tableData.length">
      </u-empty>
      <u-tr
        v-for="(item,index) in tableData"
        :key="index">
        <u-td>2021-10-10 10:00
        </u-td>
        <u-td>领取</u-td>
        <u-td>+10</u-td>
        <u-td>100</u-td>
      </u-tr>
    </u-table>
  </div>
</view>	</template>

<script>
import appProduct from '@/components/app-product'
export default {
  components: {
    appProduct
  },
  data() {
    return {
      detail: {},
      tableData: []
    }
  },
  onLoad() {
    uni.setNavigationBarTitle({
      title: '商品详情'
    })
    let option = this.routeOption().options
    let id = Number(option.id)
    this.$axios('api/ProInAndOutList/DataListPaged', 'post', { value: { InOut: 0, iType: 1, ProId: id } }).then(res => {})
    this.$axios('api/ProBasic/GetDetail', 'post', { value: id }).then(res => {
      let item = res.Value
      this.detail = {
        AllPicList: item.AllPicList,
        avatar: this.getimg(item.fPic),
        gname: item.fTitle,
        id: item.fId,
        details: [
          {
            label: '单位',
            value: item.fUnit
          },
          {
            label: '价格',
            value: item.fExMonth
          },
          {
            label: '库存数量',
            value: item.fCount
          },
          {
            label: '到期时间',
            value: item.fExTime
          },
          {
            label: '产品介绍',
            value: item.fContent
          },
          {
            label: '销售话术',
            value: item.fSpeechcraft
          }
        ]
      }
    })
  },
  methods: {
    getimg(str) {
      let img = str.replaceAll('\\', '/')
      return img.substr(1)
    }
  }
}
</script>

<style lang="scss" scoped>
</style>